package com.ruoyi.yijing.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.yijing.service.IYjCustomerGuaiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yijing.mapper.YjYuYueMapper;
import com.ruoyi.yijing.domain.YjYuYue;
import com.ruoyi.yijing.service.IYjYuYueService;

/**
 * 预约人工服务Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@Service
public class YjYuYueServiceImpl implements IYjYuYueService 
{
    @Autowired
    private YjYuYueMapper yjYuYueMapper;

    @Autowired
    private IYjCustomerGuaiService customerGuaiService;

    /**
     * 查询预约人工服务
     * 
     * @param id 预约人工服务主键
     * @return 预约人工服务
     */
    @Override
    public YjYuYue selectYjYuYueById(Long id)
    {
        YjYuYue yuYue = yjYuYueMapper.selectYjYuYueById(id);
        if (yuYue != null){
            yuYue.setCustomerGua(customerGuaiService.selectYjCustomerGuaiById(yuYue.getCustomerGuaId()));
        }
        return yuYue;
    }

    /**
     * 查询预约人工服务列表
     * 
     * @param yjYuYue 预约人工服务
     * @return 预约人工服务
     */
    @Override
    public List<YjYuYue> selectYjYuYueList(YjYuYue yjYuYue)
    {
        return yjYuYueMapper.selectYjYuYueList(yjYuYue);
    }

    /**
     * 新增预约人工服务
     * 
     * @param yjYuYue 预约人工服务
     * @return 结果
     */
    @Override
    public int insertYjYuYue(YjYuYue yjYuYue)
    {
        yjYuYue.setCreateTime(DateUtils.getNowDate());
        return yjYuYueMapper.insertYjYuYue(yjYuYue);
    }

    /**
     * 修改预约人工服务
     * 
     * @param yjYuYue 预约人工服务
     * @return 结果
     */
    @Override
    public int updateYjYuYue(YjYuYue yjYuYue)
    {
        yjYuYue.setUpdateBy(SecurityUtils.getUsername());
        yjYuYue.setUpdateTime(new Date());
        return yjYuYueMapper.updateYjYuYue(yjYuYue);
    }

    /**
     * 批量删除预约人工服务
     * 
     * @param ids 需要删除的预约人工服务主键
     * @return 结果
     */
    @Override
    public int deleteYjYuYueByIds(Long[] ids)
    {
        return yjYuYueMapper.deleteYjYuYueByIds(ids);
    }

    /**
     * 删除预约人工服务信息
     * 
     * @param id 预约人工服务主键
     * @return 结果
     */
    @Override
    public int deleteYjYuYueById(Long id)
    {
        return yjYuYueMapper.deleteYjYuYueById(id);
    }
}
